<?php

namespace App\Services\Upload;


use App\Services\Upload\Aliyun\AliyunOss;
use Hyperf\Di\Annotation\Inject;

class OssService
{
    #[Inject]
    public AliyunOss $aliyunOss;


    /**
     * 文件上传至阿里云oss（简单上传） 返回url
     * @param $localFilePath // 被上传的图片地址
     * @param $uploadFilePath // 上传到OSS的路径
     * @return mixed
     */
    public function simpleUpload($localFilePath, $uploadFilePath)
    {
        return $this->aliyunOss->simpleUpload($localFilePath, $uploadFilePath);
    }

    /**
     * 文件上传至阿里云oss（简单上传） 返回url
     * @param $content // object，被上传的文件对象
     * @param $uploadFilePath // 上传到OSS的路径
     * @return mixed
     */
    public function uploadFile($content, $uploadFilePath)
    {
        return $this->aliyunOss->uploadFile($content, $uploadFilePath);
    }

    /**
     * 获取阿里云oss临时凭证
     * @return array
     */
    public function assumeRole()
    {
        return $this->aliyunOss->assumeRole();
    }
}